package cn.chaohi.common.domain.award.model;

import java.io.Serializable;

import cn.chaohi.utils.ConfigUtils;
import cn.chaohi.utils.DESUtils;

/**
 * 加密请求返回数据
 * 
 * @author bobo
 *
 */
public class Des3CBCResp implements Serializable {

	/**
	 * 序列化
	 */
	private static final long serialVersionUID = 1L;
	
	private Integer result_code; 

	private String err_msg;
	/**
	 * 加密请求数据
	 */
	private String xy = "";

	/**
	 * 向量
	 */
	private String iv = "";


	
	public Integer getResult_code() {
		return result_code;
	}

	public void setResult_code(Integer result_code) {
		this.result_code = result_code;
	}

	public String getXy() {
		return xy;
	}

	public void setXy(String xy) {
		this.xy = xy;
	}

	public String getIv() {
		return iv;
	}

	public void setIv(String iv) {
		this.iv = iv;
	}

	
	public String getErr_msg() {
		return err_msg;
	}

	public void setErr_msg(String err_msg) {
		this.err_msg = err_msg;
	}

	public String decode() throws Exception {
		String key = ConfigUtils.getValue("applet.api.key");
		String result = DESUtils.des3DecodeCBC(key, this.xy, this.iv);
		return result;
	}

	@Override
	public String toString() {
		return "Des3CBCResp [result_code=" + result_code + ", err_msg=" + err_msg + ", xy=" + xy + ", iv=" + iv + "]";
	}

}
